<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Reads and parses a MIB file into the active MIB tree</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.snmp-get-valueretrieval.html">« snmp_get_valueretrieval</a></li>
      <li style="float: right;"><a href="function.snmp-set-enum-print.html">snmp_set_enum_print »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.snmp.html">SNMP 函数</a></li>
    <li>Reads and parses a MIB file into the active MIB tree</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.snmp-read-mib" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">snmp_read_mib</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">snmp_read_mib</span> &mdash; <span class="dc-title">
   Reads and parses a MIB file into the active MIB tree
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.snmp-read-mib-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>snmp_read_mib</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>): <span class="type">bool</span></div>

  
  <p class="para rdfs-comment">
   This function is used to load additional, e.g. vendor specific, MIBs so that
   human readable OIDs like <code class="literal">VENDOR-MIB::foo.1</code> instead of error prone numeric OIDs
   can be used.
  </p>
  <p class="para">
   The order in which the MIBs are loaded does matter as the underlying Net-SNMP
   library will print warnings if referenced objects cannot be resolved.
  </p>
  
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.snmp-read-mib-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">filename</code></dt>

     <dd>
<p class="para">The filename of the <abbr>MIB</abbr>.</p></dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.snmp-read-mib-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.snmp-read-mib-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4460">
    <p><strong>示例 #1 Using <span class="function"><strong>snmp_read_mib()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />&nbsp;print_r</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">snmprealwalk</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'public'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'.1.3.6.1.2.1.2.3.4.5'</span><span style="color: #007700">)&nbsp;);<br />&nbsp;<br />&nbsp;</span><span style="color: #0000BB">snmp_read_mib</span><span style="color: #007700">(</span><span style="color: #DD0000">'./FOO-BAR-MIB.txt'</span><span style="color: #007700">);<br />&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">snmprealwalk</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'public'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'FOO-BAR-MIB::someTable'</span><span style="color: #007700">)&nbsp;);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
  <p class="para">
   The above example is made up but the results would look like:
<div class="cdata"><pre>     
Array
(
    [iso.3.6.1.2.1.2.3.4.5.0] =&gt; Gauge32: 6
)
Array
(
    [FOO-BAR-MIB::someTable.0] =&gt; Gauge32: 6
)
</pre></div>
  </p>
 </div>

 
</div></div></div></body></html>